/**
 * 
 */
package systole.domain.analysis;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import systole.domain.analysis.results.AnalysisResult;
import systole.domain.clinicalInformation.ClinicalInformation;
import systole.domain.persons.Medic;
import systole.domain.persons.Patient;
import systole.domain.report.Report;
import systole.domain.signals.FinalSignal;
import systole.domain.signals.RawSignal;
import systole.domain.signals.Segment;
import systole.domain.signals.SelectedSegment;
import systole.domain.signals.Signal;
import systole.domain.signals.SignalFrequency;

/**
 *
 * Represents the analysis that is done the patient from the file
 *
 * @author juan
 *
 */
public class Analysis implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 6267567966273192177L;
    /**
     * Id of Analysis.
     */
    private Integer id;
    /**
     *  Analysis creation date.
     */
    private Date creationDay;
    /**
     *  Analysis date.
     */
    private Date analysisDay;
    /**
     *  Analysis Patient.
     */
    private Patient patient;
    /**
     *  Patient medic for Analysis.
     */
    private Medic medic;
    /**
     *  Final segment of Analysis.
     */
    private FinalSignal finalSegment;
    /**
     *  Complete signal of Analysis.
     */
    private Segment signalFiltered;
    /**
     *  AnalisysResult of Analysis.
     */
    private AnalysisResult analysisResult;    
    /**
     * Raw signal, as was loaded from file.
     */
    private RawSignal rawSignal;
    /**
     *  All segment for Analysis.
     */
    private Signal allSegments;
    /**
     *  selected segment for Analysis.
     */
    private Collection<SelectedSegment> selectedSegments = new ArrayList<SelectedSegment>();
    /**
     *  Path of signal file.
     */
    private String filePath;
    /**
     *  Name of the selected file
     */
    private String fileName;
    private SignalFrequency signalFrequency;
    private Report report;
    private ClinicalInformation clinicalInformation;

    /**
     * Empty Constructor.
     */
    public Analysis() {
        super();
        this.analysisDay = Calendar.getInstance().getTime();
    }

    /**
     * @return The Analysis date.
     */
    public Date getCreationDay() {
        return this.creationDay;
    }

    /**
     * @param date The Analysis date.
     */
    public void setCreationDay(Date date) {
        this.creationDay = date;
    }

    /**
     *
     * @return Patient of Analysis.
     */
    public Patient getPatient() {
        return this.patient;
    }

    /**
     *
     * @param patient  Patient of Analysis.
     */
    public void setPatient(Patient patient) {
        this.patient = patient;
    }

    /**
     * @return The medic for Analysis.
     */
    public Medic getMedic() {
        return this.medic;
    }

    /**
     * @param medic The medic for Analysis.
     */
    public void setMedic(Medic medic) {
        this.medic = medic;
    }

    /**
     * @return The final Segment.
     */
    public FinalSignal getFinalSegment() {
        return this.finalSegment;
    }

    /**
     * @param finalSegment Final segment of Analysis.
     */
    public void setFinalSegment(FinalSignal finalSegment) {
        this.finalSegment = finalSegment;
    }

    /**
     * @return The complete signal.
     */
    public Segment getSignalFiltered() {
        return this.signalFiltered;
    }

    /**
     * @param signalFiltered The complete signal.
     */
    public void setSignalFiltered(Segment signalFiltered) {
        this.signalFiltered = signalFiltered;
    }

    /**
     * @return Analysis result.
     */
    public AnalysisResult getAnalysisResult() {
        return this.analysisResult;
    }

    /**
     * @param analysisResult The result of analysis.
     */
    public void setAnalysisResult(AnalysisResult analysisResult) {
        this.analysisResult = analysisResult;
    }

    /**
     *
     * @return Raw signal, as was loaded from file.
     */
    public RawSignal getRawSignal() {
        return this.rawSignal;
    }

    /**
     *
     * @param rawSignal The raw signal, as was loaded from file.
     */
    public void setRawSignal(RawSignal rawSignal) {
        this.rawSignal = rawSignal;
    }

   

    /**
     *
     * @return all segments of signal.
     */
    public Signal getAllSegments() {
        return this.allSegments;
    }

    /**
     *
     * @param allSegments All segments of signal.
     */
    public void setAllSegments(Signal allSegments) {
        this.allSegments = allSegments;
    }

    /**
     * @return the selectedSegments
     */
    public Collection<SelectedSegment> getSelectedSegments() {
        return selectedSegments;
    }

    /**
     * @param selectedSegments the selectedSegments to set
     */
    public void setSelectedSegments(Collection<SelectedSegment> selectedSegments) {
        this.selectedSegments = selectedSegments;
    }

    /**
     *
     * @return file path.
     */
    public String getFilePath() {
        return this.filePath;
    }

    /**
     *
     * @param filePath Path of signal file.
     */
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    /**
     * @param id the id to set
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return the id
     */
    public Integer getId() {
        return this.id;
    }

    /**
     * @param signalFrequency the signalFrequency to set
     */
    public void setSignalFrequency(SignalFrequency signalFrequency) {
        this.signalFrequency = signalFrequency;
    }

    /**
     * @return the signalFrequency
     */
    public SignalFrequency getSignalFrequency() {
        return this.signalFrequency;
    }

    /**
     * @param report set report.
     */
    public void setReport(Report report) {
        this.report = report;
    }

    /**
     * @return The report.
     */
    public Report getReport() {
        return this.report;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result
                + ((this.creationDay == null) ? 0 : this.creationDay.hashCode());
        result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
        result = prime * result + ((this.patient == null) ? 0 : this.patient.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Analysis)) {
            return false;
        }
        Analysis other = (Analysis) obj;
        if (this.creationDay == null) {
            if (other.creationDay != null) {
                return false;
            }
        } else if (!this.creationDay.equals(other.creationDay)) {
            return false;
        }
        if (this.id == null) {
            if (other.id != null) {
                return false;
            }
        } else if (!this.id.equals(other.id)) {
            return false;
        }
        if (this.patient == null) {
            if (other.patient != null) {
                return false;
            }
        } else if (!this.patient.equals(other.patient)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Analysis [" + "date " + this.creationDay + " " + "patient " + this.patient + "]";
    }

    /**
     * @return the analysisDay
     */
    public Date getAnalysisDay() {
        return this.analysisDay;
    }

    /**
     * @param analysisDay the analysisDay to set
     */
    public void setAnalysisDay(Date analysisDay) {
        this.analysisDay = analysisDay;
    }

    /**
     * @return the fileName
     */
    public String getFileName() {
        return fileName;
    }

    /**
     * @param fileName the fileName to set
     */
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    /**
     * @param clinicalInformation the clinicalInformation to set
     */
    public void setClinicalInformation(ClinicalInformation clinicalInformation) {
        this.clinicalInformation = clinicalInformation;
    }

    /**
     * @return the clinicalInformation
     */
    public ClinicalInformation getClinicalInformation() {
        return clinicalInformation;
    }
   
}
